package domain;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Entity
@Access(AccessType.PROPERTY)
@Table(indexes = {@Index(columnList = "peopleRequired")})
public class Vacancy extends DomainEntity {
	//Constructors

	public Vacancy() {
		super();

	}

	//Attributes
	private int peopleRequired;
	private int totalPeopleRequired;
	
	@Min(0)
	public int getPeopleRequired() {
		return peopleRequired;
	}

	public void setPeopleRequired(int peopleRequired) {
		this.peopleRequired = peopleRequired;
	}
	
	@Min(0)
	public int getTotalPeopleRequired() {
		return totalPeopleRequired;
	}

	public void setTotalPeopleRequired(int totalPeopleRequired) {
		this.totalPeopleRequired = totalPeopleRequired;
	}

	// Relationships
	private UserGroup userGroup;
	private Project project;

	@Valid
	@NotNull
	@ManyToOne(optional = false)
	public UserGroup getUserGroup() {
		return userGroup;
	}

	public void setUserGroup(UserGroup userGroup) {
		this.userGroup = userGroup;
	}

	@Valid
	@NotNull
	@ManyToOne(optional = false)
	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	

}
